import package2.Animal;
import package2.Dog;
import package2.Duck;
import package2.Snack;

public class Test {
    //多态
    //使用函数
    public static void run(Animal animal)  {
        animal.run();
    }
    public static void main(String[] args) {
//        Son son = new Son();
//        son.eat();
//        son = new XiaoZhen();
//        son.eat();
//        son = new XiaoTian();
//        son.eat();

        Animal animal = new Animal();
        run(animal);
        animal = new Dog();
        run(animal);
        animal = new Duck();
        run(animal);
        animal = new Snack();
        run(animal);
    }
}
